package com.taxipark.service.connection;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionProviderImpl implements ConnectionProvider {
	private final String url;
	private final String username;
	private final String password;

	static {
		try {
			Class.forName("com.mysql.jdbc.Driver");
		} catch (ClassNotFoundException e) {
			System.out.println("Class " + "com.mysql.jdbc.Driver" + " not found");
		}
	}

	public ConnectionProviderImpl(String url, String username, String password) {
		this.url = url;
		this.username = username;
		this.password = password;
	}

	@Override
	public Connection provide() throws SQLException {
		return DriverManager.getConnection(url, username, password);
	}

}
